<template>
  <div>
    <MyHeader></MyHeader>
    <div id="lei">
      <MyGoods v-for="obj in list" :key="obj.id" :objName="obj"></MyGoods>
    </div>
    <MyFooter @cck="cck" :arr="list"></MyFooter>
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader";
import MyFooter from "./components/MyFooter";
import MyGoods from "./components/MyGoods";
export default {
  components: {
    // eslint-disable-next-line vue/no-unused-components
    MyHeader,
    // eslint-disable-next-line vue/no-unused-components
    MyFooter,
    // eslint-disable-next-line vue/no-unused-components
    MyGoods,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.$axios({
      url: "/api/cart",
    }).then((res) => {
      // console.log(res);
      this.list = res.data.list;
    });
  },
  methods: {
    cck(bool) {
      this.list.forEach((obj) => {
        obj.goods_state = bool;
      });
    },
  },
};
</script>

<style>
#lei {
  margin-top: 45px;
  margin-bottom: 50px;
}
</style>